package com.appspot.mymovietracker;

import com.vaadin.Application;
import com.vaadin.data.util.BeanItem;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Window;

public class MyMovieTrackerApplication extends Application {

	private Form form = new Form();

	@Override
	public void init() {
		Window mainWindow = new Window("My Movie Tracker");
		
		Movie movie = new Movie();
		movie.setTitle("Test");
		BeanItem item = new BeanItem(movie);
		form.setItemDataSource(item);
		
		/*
		DateField date = new DateField("Date");
		date.setDateFormat("MM-dd-yyyy");
		form.addField("date", date);
		TextField title = new TextField("Title");
		form.addField("title", title);
		TextField rating = new TextField("Rating");
		rating.setColumns(1);
		form.addField("rating", rating);		
		TextField imdbCode = new TextField("IMDB Code");
		form.addField("imdbCode", imdbCode);
		*/
		
		HorizontalLayout okbar = new HorizontalLayout();
		okbar.setHeight("25px");
		
		form.getFooter().addComponent(okbar);
		Button okbutton = new Button("OK", form, "commit");
		okbar.addComponent(okbutton);
		okbar.setComponentAlignment(okbutton, Alignment.TOP_RIGHT);
		okbar.addComponent(new Button("Reset", form, "discard"));
		
		mainWindow.addComponent(form);
		setMainWindow(mainWindow);
	}

}
